/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package siswa;

import java.awt.Color;
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;

/**
 *
 * @author Rendra
 */
public class Siswa extends javax.swing.JFrame {
    /**
     * Creates new form Siswa
     */
    public Siswa() {
        initComponents();
        App.appconn.openConn();
        StatusPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0));
        AppDesktopPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
        mainShow();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        StatusPanel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        AppDesktopPane = new javax.swing.JDesktopPane();
        MainMenu = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Pembantu Penentuan Masuk Sekolah Tingkat Menengah");
        setResizable(false);

        jLabel1.setText("Rancang Bangun Aplikasi Penentu Masuk Sekolah Menengah Menggunakan Metode Iterative Dichotomiser 3 ( ID3 )");
        jLabel1.setToolTipText("");

        javax.swing.GroupLayout StatusPanelLayout = new javax.swing.GroupLayout(StatusPanel);
        StatusPanel.setLayout(StatusPanelLayout);
        StatusPanelLayout.setHorizontalGroup(
            StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, StatusPanelLayout.createSequentialGroup()
                .addContainerGap(141, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addContainerGap())
        );
        StatusPanelLayout.setVerticalGroup(
            StatusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, StatusPanelLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jLabel1))
        );

        jMenu1.setText("Dataset");

        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/red_line.png"))); // NOI18N
        jMenuItem4.setText("Criteria");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/data_sort.png"))); // NOI18N
        jMenuItem5.setText("Load Dataset");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem5);

        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/card_import.png"))); // NOI18N
        jMenuItem6.setText("Import");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem6);

        MainMenu.add(jMenu1);

        jMenu2.setText("Help");

        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/ask_and_answer.png"))); // NOI18N
        jMenuItem1.setText("How To Use");
        jMenu2.add(jMenuItem1);

        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/folders_explorer.png"))); // NOI18N
        jMenuItem2.setText("About ID3 Method");
        jMenu2.add(jMenuItem2);

        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/information.png"))); // NOI18N
        jMenuItem3.setText("App Information");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        MainMenu.add(jMenu2);

        setJMenuBar(MainMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(StatusPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(AppDesktopPane)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(AppDesktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 459, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(StatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        // TODO add your handling code here:
        clearDesktopPane();
        Criteria frm = new Criteria();
        AppDesktopPane.add(frm);
        frm.setVisible(true);
        frm.setBorder(null);
        try {
            frm.setMaximum(true);
            ((javax.swing.plaf.basic.BasicInternalFrameUI)frm.getUI()).setNorthPane(null);
            frm.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
        } catch (PropertyVetoException pvx) {
            Logger.getLogger(Siswa.class.getName()).log(Level.SEVERE, null, pvx);
        }
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        // TODO add your handling code here:
        clearDesktopPane();
        LoadDataset frm = new LoadDataset();
        AppDesktopPane.add(frm);
        frm.setVisible(true);
        frm.setBorder(null);
        try {
            frm.setMaximum(true);
            ((javax.swing.plaf.basic.BasicInternalFrameUI)frm.getUI()).setNorthPane(null);
            frm.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
        } catch (PropertyVetoException pvx) {
            Logger.getLogger(Siswa.class.getName()).log(Level.SEVERE, null, pvx);
        }
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        // TODO add your handling code here:
        clearDesktopPane();
        ImportDataset frm = new ImportDataset();
        AppDesktopPane.add(frm);
        frm.setVisible(true);
        frm.setBorder(null);
        try {
            frm.setMaximum(true);
            ((javax.swing.plaf.basic.BasicInternalFrameUI)frm.getUI()).setNorthPane(null);
            frm.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
        } catch (PropertyVetoException pvx) {
            Logger.getLogger(Siswa.class.getName()).log(Level.SEVERE, null, pvx);
        }
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        new AppInformation(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void mainShow() {
        clearDesktopPane();
        Background frm = new Background();
        AppDesktopPane.add(frm);
        frm.setVisible(true);
        frm.setBorder(null);
        try {
            frm.setMaximum(true);
            ((javax.swing.plaf.basic.BasicInternalFrameUI)frm.getUI()).setNorthPane(null);
            frm.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
        } catch (PropertyVetoException pvx) {
            Logger.getLogger(Siswa.class.getName()).log(Level.SEVERE, null, pvx);
        }
    }
    
    private void clearDesktopPane(){
        AppDesktopPane.removeAll();
        AppDesktopPane.repaint();
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new Siswa().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane AppDesktopPane;
    private javax.swing.JMenuBar MainMenu;
    private javax.swing.JPanel StatusPanel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    // End of variables declaration//GEN-END:variables
}
